from rest_framework import serializers
from users.models import Person
#
#
class PersonSerializer(serializers.ModelSerializer):
    """
    Person的序列化起 todo 为什么不能序列化 --> 因为我继承错了， 应该继承ModelSerializer
    """

    # gender = serializers.ChoiceField(source='get_gender_display',choices = Person.GENDER_CHOICES, default='2')

    class Meta:
        model = Person
        fields = '__all__'
        # read_only_fields = ('mobile', )
        # read_only_fields = (
        # 'card_id', 'name', 'permanent_residence', 'mobile', 'gender', 'age', 'is_vaccine', 'status', 'image')

#
# """
# {"name": "何瞰", "mobile": "18839460901", "permanent_residence": "河南省", "card_id": "0", "gender": "2", "age": 98, "is_vaccine": false, "status": "1", "image": "http://121.196.107.223:8000/img/127.jpeg"}
#
# """
